package com.gf.user.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.gf.base.type.FileType;
import com.gf.common.util.WebHelper;
import com.gf.user.dao.UploadFileRecordDao;
import com.gf.user.service.UploadFileRecordService;

/**
 * 
 * @author zhuguifeng guifeng.net@gmail.com
 * @version 创建时间：2012-11-14 下午1:44:32
 */
@Transactional
@Service("uploadFileRecordService")
public class UploadFileRecordServiceImpl implements UploadFileRecordService {

	@Autowired
	private UploadFileRecordDao uploadFileRecordDao;

	/**
	 * 保存用户的上传文件记录
	 */
	@Transactional(propagation=Propagation.REQUIRED,rollbackFor=Exception.class)
	@Override
	public void saveUploadRecored(long userId, String filePath,
			FileType fileType) {

		String uploadIp = WebHelper.getClientIp(null);
		uploadFileRecordDao.insert(userId, filePath, fileType, uploadIp);
	}

}
